import time
def sorting(name):
    start = time.time()
    f = open(name)
    sp = [int(el.strip()) for el in f.readlines()]
    f.close
    n = len(sp)
    for i in range(n - 1):
        for j in range(n - 1 - i):
            if sp[j] > sp[j + 1]:
                sp[j], sp[j + 1] = sp[j + 1], sp[j]
    finish = time.time()
    t = round((finish - start) * 1000)
    print(name[:-4], t, 'milliseconds')
    
sorting('m1_sorted.txt')
sorting('m2_reverse.txt')
sorting('m3_shuffle.txt')